import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    //定义一个共享数据，控制底部导航显示隐藏
    isShowFooter:true,
    token:localStorage.getItem('token')||'',
    userId:localStorage.getItem('userId')||'',
  },
  mutations: {
    setUserId(state, userId){
      localStorage.setItem('userId',userId)
      state.userId = userId
    },
    setToken(state,token){
      localStorage.setItem('token',token)
      state.token = token
    },
    chuxian(state){
      state.isShowFooter = true
    },
    hide(state){
      state.isShowFooter = false
    }
  },
  actions: {
  },
  modules: {
  }
})
